﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace OpenMms.Domain.Models
{
    public partial class OpenMmsDBContext : DbContext
    {
        public OpenMmsDBContext()
        {
        }

        public OpenMmsDBContext(DbContextOptions<OpenMmsDBContext> options)
            : base(options)
        {
        }

        public virtual DbSet<Bouns> Bouns { get; set; }
        public virtual DbSet<BusinessLog> BusinessLog { get; set; }
        public virtual DbSet<Consumption> Consumption { get; set; }
        public virtual DbSet<Managers> Managers { get; set; }
        public virtual DbSet<MemberLevel> MemberLevel { get; set; }
        public virtual DbSet<Messages> Messages { get; set; }
        public virtual DbSet<MoneyTransfor> MoneyTransfor { get; set; }
        public virtual DbSet<Notice> Notice { get; set; }
        public virtual DbSet<Orders> Orders { get; set; }
        public virtual DbSet<Parameters> Parameters { get; set; }
        public virtual DbSet<Params> Params { get; set; }
        public virtual DbSet<Products> Products { get; set; }
        public virtual DbSet<RealMoneyApply> RealMoneyApply { get; set; }
        public virtual DbSet<ServiceCentre> ServiceCentre { get; set; }
        public virtual DbSet<ShopCart> ShopCart { get; set; }
        public virtual DbSet<UserGiro> UserGiro { get; set; }
        public virtual DbSet<UserInforMations> UserInforMations { get; set; }
        public virtual DbSet<UserUpgrade> UserUpgrade { get; set; }
        public virtual DbSet<VirtualMoneyApply> VirtualMoneyApply { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.HasAnnotation("ProductVersion", "2.2.1-servicing-10028");

            modelBuilder.Entity<Bouns>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.CreateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Message)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Type)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<BusinessLog>(entity =>
            {
                entity.Property(e => e.Affair).IsUnicode(false);

                entity.Property(e => e.CreateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.LogType).HasDefaultValueSql("((0))");

                entity.Property(e => e.Operator)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Relevant)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Consumption>(entity =>
            {
                entity.Property(e => e.Affair)
                    .HasMaxLength(200)
                    .IsUnicode(false);

                entity.Property(e => e.Amout).HasColumnType("money");

                entity.Property(e => e.CreateDate)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.Operator)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Relevant)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Managers>(entity =>
            {
                entity.Property(e => e.ManagerCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ManagerPassword)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<MemberLevel>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.LevelId).HasColumnName("LevelID");

                entity.Property(e => e.LevelName)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.TotalAchie).HasColumnType("money");
            });

            modelBuilder.Entity<Messages>(entity =>
            {
                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.Mcontent)
                    .HasColumnName("MContent")
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ReciveCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SendCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SendName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SendPhone)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Title)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<MoneyTransfor>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.CreateTime).HasColumnType("datetime");

                entity.Property(e => e.Remark)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Notice>(entity =>
            {
                entity.Property(e => e.Author)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CreateDate).HasColumnType("datetime");

                entity.Property(e => e.Ncontent).IsUnicode(false);

                entity.Property(e => e.Title)
                    .HasMaxLength(200)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Orders>(entity =>
            {
                entity.Property(e => e.Addresss)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.Detail).IsUnicode(false);

                entity.Property(e => e.Phone)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Price).HasColumnType("money");

                entity.Property(e => e.ProductImage)
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.ProductName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Total).HasColumnType("money");

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<Parameters>(entity =>
            {
                entity.Property(e => e.Param1)
                    .HasColumnName("param1")
                    .HasColumnType("money");

                entity.Property(e => e.Param10)
                    .HasColumnName("param10")
                    .HasColumnType("money");

                entity.Property(e => e.Param2)
                    .HasColumnName("param2")
                    .HasColumnType("money");

                entity.Property(e => e.Param3)
                    .HasColumnName("param3")
                    .HasColumnType("money");

                entity.Property(e => e.Param4)
                    .HasColumnName("param4")
                    .HasColumnType("money");

                entity.Property(e => e.Param5)
                    .HasColumnName("param5")
                    .HasColumnType("money");

                entity.Property(e => e.Param6)
                    .HasColumnName("param6")
                    .HasColumnType("money");

                entity.Property(e => e.Param7)
                    .HasColumnName("param7")
                    .HasColumnType("money");

                entity.Property(e => e.Param8)
                    .HasColumnName("param8")
                    .HasColumnType("money");

                entity.Property(e => e.Param9)
                    .HasColumnName("param9")
                    .HasColumnType("money");
            });

            modelBuilder.Entity<Params>(entity =>
            {
                entity.Property(e => e.ServiceCharge).HasColumnType("money");
            });

            modelBuilder.Entity<Products>(entity =>
            {
                entity.Property(e => e.Company)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CostPrice).HasColumnType("money");

                entity.Property(e => e.ProductDetail).IsUnicode(false);

                entity.Property(e => e.ProductImage)
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.ProductName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.VipPrice).HasColumnType("money");
            });

            modelBuilder.Entity<RealMoneyApply>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.ApplyTime).HasColumnType("datetime");

                entity.Property(e => e.BankCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.BankName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.CardHolder)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.HandleTime).HasColumnType("datetime");

                entity.Property(e => e.RealAmount).HasColumnType("money");

                entity.Property(e => e.Remark)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ServiceCentre>(entity =>
            {
                entity.Property(e => e.Address)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.Name)
                    .HasMaxLength(255)
                    .IsUnicode(false);

                entity.Property(e => e.ServiceCenterCode)
                    .HasMaxLength(255)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<ShopCart>(entity =>
            {
                entity.Property(e => e.Detail).IsUnicode(false);

                entity.Property(e => e.Price).HasColumnType("money");

                entity.Property(e => e.ProductImage)
                    .HasMaxLength(500)
                    .IsUnicode(false);

                entity.Property(e => e.ProductsName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Total).HasColumnType("money");
            });

            modelBuilder.Entity<UserGiro>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.CreateTime).HasColumnType("datetime");

                entity.Property(e => e.ReceiveCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ReceiveName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Remark)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<UserInforMations>(entity =>
            {
                entity.HasKey(e => e.UserId)
                    .HasName("PK__UserInfo__1788CC4C44FF419A");

                entity.Property(e => e.ActivationTime).HasColumnType("datetime");

                entity.Property(e => e.BankCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.BankName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Bonus)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.CardHolder)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ContactCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ContactId).HasDefaultValueSql("((0))");

                entity.Property(e => e.IdNumber)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Investment)
                    .HasColumnType("money")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.LeftAchie)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.LeftCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.LevelName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.Phone)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.RealMoney)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.RefereeCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.RefereeCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.RefereeId).HasDefaultValueSql("((0))");

                entity.Property(e => e.RegistionTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("(getdate())");

                entity.Property(e => e.RightAchie)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");

                entity.Property(e => e.RightCount).HasDefaultValueSql("((0))");

                entity.Property(e => e.SecretAnswer)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.SecurityQuestion)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.ServiceCentreCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserPassWord)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserSecondPassWord)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.VirtualMoney)
                    .HasColumnType("decimal(18, 0)")
                    .HasDefaultValueSql("((0))");
            });

            modelBuilder.Entity<UserUpgrade>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("decimal(18, 0)");

                entity.Property(e => e.UpgradeDate).HasColumnType("datetime");

                entity.Property(e => e.UserCode)
                    .HasMaxLength(255)
                    .IsUnicode(false);
            });

            modelBuilder.Entity<VirtualMoneyApply>(entity =>
            {
                entity.Property(e => e.Amount).HasColumnType("money");

                entity.Property(e => e.ApplyTime).HasColumnType("datetime");

                entity.Property(e => e.HandleTime).HasColumnType("datetime");

                entity.Property(e => e.Remark)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserCode)
                    .HasMaxLength(50)
                    .IsUnicode(false);

                entity.Property(e => e.UserName)
                    .HasMaxLength(50)
                    .IsUnicode(false);
            });
        }
    }
}
